Skip to content

Sending operations asynchronously #17

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Aug 21, 2024
Merged

Sending operations asynchronously #17

merged 22 commits into from
Aug 21, 2024

Conversation

Raalsky
Copy link
Contributor

@Raalsky Raalsky commented Aug 19, 2024

No description provided.

@Raalsky Raalsky requested review from normandy7 and szaganek August 19, 2024 11:21
@Raalsky Raalsky force-pushed the rj/basic-submission-flow branch 2 times, most recently from c1fda0b to 16294ab Compare August 19, 2024 12:51
@Raalsky Raalsky marked this pull request as ready for review August 20, 2024 08:05
@Raalsky Raalsky requested a review from normandy7 August 20, 2024 08:05
_, alive = psutil.wait_procs(children, timeout=KILL_TIMEOUT)
for child_proc in alive:
_kill(child_proc)
# finish with terminating self
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sys.exit() would work as well

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actuall I would use os.killpg using the parent's process group ID. This will kill all children processes on OS level

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

os.killpg is not available on Windows, sys.exit() will just "close" the process, instead we would like to allow script to gentle handle the KeyboardInterrupt and clean some stuff.


class QueueElement(NamedTuple):
sequence_id: int
occured_at: float
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about renaming this field to timestamp?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@Raalsky Raalsky requested a review from kgodlewski August 21, 2024 07:50
if len(serialized_operation) > MAX_QUEUE_ELEMENT_SIZE:
raise ValueError(f"Operation size exceeds the maximum allowed size ({MAX_QUEUE_ELEMENT_SIZE})")
if len(serialized_operation) > MAX_QUEUE_ELEMENT_SIZE:
raise ValueError(f"Operation size exceeds the maximum allowed size ({MAX_QUEUE_ELEMENT_SIZE})")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Operation size" sounds a bit strange.

Suggested change
raise ValueError(f"Operation size exceeds the maximum allowed size ({MAX_QUEUE_ELEMENT_SIZE})")
raise ValueError(f"The number of queued operations exceeds the maximum allowed size ({MAX_QUEUE_ELEMENT_SIZE})")

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not the number of operations and this probably will never be raised

Base automatically changed from dev/minimal-flow to main August 21, 2024 11:45
@Raalsky Raalsky requested a review from normandy7 August 21, 2024 12:00
Raalsky and others added 9 commits August 21, 2024 16:02
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
Co-authored-by: Sabine <sabine.nyholm@neptune.ai>
@Raalsky Raalsky force-pushed the rj/basic-submission-flow branch from a89c60f to e9659f3 Compare August 21, 2024 14:02
@Raalsky Raalsky dismissed normandy7’s stale review August 21, 2024 16:58

Easier to get it working on main in separate PR

@Raalsky Raalsky merged commit 5a12490 into main Aug 21, 2024
4 checks passed
@Raalsky Raalsky deleted the rj/basic-submission-flow branch August 21, 2024 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants